import { defineStore } from 'pinia';

/**
 * 存储状态的处理
 */
export const useLoginStore = defineStore('loginStore', {
    state: () => {
        return {
            authorization: ''
        }
    },
    actions: {
        /**
         * 更新登陆凭证
         */
        setToken(value) {
            this.authorization = value
        },
        /**
         * 检测当前是否已经登陆
         */
        isLogin() {
            return this.authorization ? true : false;
        }
    },
    persist: true,
})